<template>
	<view class="section-item">
		<index-item-hd @opendetail="opendetail" :itemInfo="itemInfo" />
		<view class="item-content u-f1 u-f u-f-jsb">
			<image v-for="workItem,i in currentWork" :key="workItem.url" @tap="opendetail()" :src="workItem.url" />
		</view>

	</view>

</template>

<script>
	import indexItemHd from "./index-item-hd"
	export default {
		props: {
			itemInfo: Object,
			isIndex: Boolean //是否为index页面
		},
		components: {
			indexItemHd
		},
		computed:{
			currentWork(){
				return  this.itemInfo.work.length ? this.itemInfo.work.slice(0,3) :[{url:this.deafultSrc}]
			}
		},
		data() {
			return {

			};
		},
		methods: {
			// 被点击的作品索引
			opendetail(index) {
				let {
					type,
					topic_id
				} = this.itemInfo;
				if (this.isIndex) {
					uni.navigateTo({
						url: `index/index_detail/index_detail?type=${type}`,
					});
				} else {
					uni.navigateTo({
						url: `huati/huati_detail/huati_detail?index=${topic_id}`,
					});
				}

				// this.User.addHistoryList(this.item);
			}
		}
	}
</script>

<style lang="scss" scoped>
	// item
	.section-item {
		padding: 30upx 20upx 34upx;
		box-shadow: 6px 12px 20px 0px rgba(201, 201, 201, 0.2);
		border-radius: 9px;


		.item-content {
			margin-top: 20upx;

			image {
				width: 206upx;
				height: 206upx;
			}
		}

	}
</style>
